/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "hks_useridm_api_wrap_mock.h"

#define PARAMSID_MAX 2

static struct SecInfoWrap SecInfoParams[PARAMSID_MAX] = {
    {
        .secureUid = 0,
        .enrolledInfoLen = 1
    }, {
        .secureUid=0,
        .enrolledInfoLen = 2
    }
};

static struct EnrolledInfoWrap EnrolledInfoParams[PARAMSID_MAX][DEFAULT_MAX_ENROLLED_INFO_LEN] = {
    {
        {
            .authType = PIN,
            .enrolledId = 2
        } 
    },{    
        {
            .authType = PIN,
            .enrolledId = 0
        }, {
            .authType = FACE,
            .enrolledId = 1
        }
    }
};

int32_t g_ParamsId = 0;

int32_t HksUserIdmGetSecInfo(int32_t userId, struct SecInfoWrap **outSecInfo)
{
    if (outSecInfo == nullptr)
        return INVALID_PARAMETERS;
    (*outSecInfo)->secureUid = SecInfoParams[g_ParamsId].secureUid;
    (*outSecInfo)->enrolledInfoLen = SecInfoParams[g_ParamsId].enrolledInfoLen;
    for (uint32_t i = 0; i < SecInfoParams[g_ParamsId].enrolledInfoLen; i++) {
        (*outSecInfo)->enrolledInfo[i] = EnrolledInfoParams[g_ParamsId][i];
    }
    g_ParamsId = (g_ParamsId + 1) % PARAMSID_MAX;
    return HKS_SUCCESS;
}

